{extend name="common/base" }

{block name="content"}
<div class="am-g">
	<div class="am-u-sm-12 am-u-md-6">
		<div class="am-btn-toolbar">
			<div class="am-btn-group am-btn-group-xs">
				<a class="am-btn am-btn-default" href="{:url('add', ['pid' => $pid])}">
					<span class="am-icon-plus"></span> 新增
				</a>
				<a class="am-btn am-btn-default nd-refresh">
					<span class="am-icon-refresh"></span> 刷新
				</a>
				{if condition="$pid gt 0"}
				<a class="am-btn am-btn-default nd-backward">
					<span class="am-icon-reply"></span> 返回
				</a>
				{/if}
			</div>
		</div>
	</div>
	<div class="am-u-sm-12 am-u-md-6">
		<div class="am-btn-toolbar">
			<div class="am-btn-group am-btn-group-xs" style="float: right">
				<a class="am-btn am-btn-default {eq name='group' value=''}nd-group-select{/eq}" href="{:url('index', ['pid' => $pid])}">
					全部
				</a>
			{volist name="group_list" id="vo"}
				{if condition="!empty($vo.menu_group)"}
				<a class="am-btn am-btn-default {eq name='group' value='$vo.menu_group'}nd-group-select{/eq}" href="{:url('index', ['pid' => $pid, 'group' => $vo['menu_group']])}">
					{$vo.menu_group|default='默认'}
				</a>
				{/if}
			{/volist}
			</div>
		</div>
	</div>
</div>
<br/>

<div class="am-g">
	<div class="am-u-sm-12">
		<table class="am-table am-table-striped am-table-radius am-table-bordered">
			<thead>
				<tr>
					<th>名称</th>
					<th>链接</th>
					<th>分组</th>
					<th>排序</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			{volist name="_list" id="vo"}
				<tr>
					<td><a href="{:url('index', ['pid' => $vo['id']])}">{$vo.menu_name}</a></td>
					<td title="{$vo.menu_flag}">{$vo.menu_url}</td>
					<td>{$vo.menu_group}</td>
					<td class="am-form">
					   {$widget->row('text', ['value' => $vo['menu_sort'], 'url' => url('modify', ['id' => $vo['id'], 'field' => 'menu_sort'])])}
					</td>
					<td>
					   {$widget->row('select', ['value' => $vo['menu_status'], 'list' => $status_list, 'url' => url('modify', ['id' => $vo['id'], 'field' =>  'menu_status'])])}
					</td>
					<td>
						<div class="am-btn-toolbar">
							<div class="am-btn-group am-btn-group-xs">
								{$widget->row('button', ['title' => '编辑', 'class' => 'am-text-secondary', 'icon' => 'am-icon-pencil-square-o', 'url' => url('edit', ['id' => $vo['id']])])}
								{$widget->row('button', ['title' => '删除', 'class' => 'am-text-danger ajax-get ajax-confirm', 'icon' => 'am-icon-trash-o', 'url' => url('delete', ['id' => $vo['id']])])}
							</div>
						</div>
					</td>
				</tr>
			{/volist}
			</tbody>
		</table>
	</div>
</div>
{/block}